package com.jxt.myjxtmanager.ui.presenter;

import android.content.Context;

import com.jxt.myjxtmanager.db.Student;
import com.jxt.myjxtmanager.ui.inter.CheckWorkInter;
import com.jxt.myjxtmanager.ui.model.CheckWorkMo;
import com.jxt.myjxtmanager.views.CustomProgressDialog;

import java.util.List;

/**
 * Created by qm on 2017/2/10 0010.
 */
public class CheckWorkPresenter implements CheckWorkMo.OnFindAllDataListener {

    private final CustomProgressDialog dialog;
    private CheckWorkMo checkWorkMo;
    private CheckWorkInter inter;


    public CheckWorkPresenter(Context cxt, CheckWorkInter inter) {
        this.inter = inter;
        checkWorkMo = new CheckWorkMo(cxt);
        checkWorkMo.setOnFindAllDevicesListener(this);
        checkWorkMo.getQueryList();

        dialog = new CustomProgressDialog(cxt, "");
//        animUtils = new TranslateAnimUtils(cxt, 4);
    }

    public List<Student> getDataList() {
        return checkWorkMo.getQueryList();
    }

    public void dismissDialog() {
        if (dialog != null) {
            dialog.dismiss();
        }
    }

    public String getLateNum() {
        return checkWorkMo.getLateNum();
    }

    public void RequestData() {
        if (dialog != null) {
            dialog.showDialog();
        }
        checkWorkMo.RequestData();
    }


    @Override
    public void onFindSuccess(List<Student> workBeans) {
        inter.setMyAdapter();
    }

    @Override
    public void OnFindAllDataSuccess(String strTitle) {

    }

    @Override
    public void onFailure() {

    }

    @Override
    public void onError() {

    }
}
